<?php
/**
 * Sharing View for Sharing World Component
 * 
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link http://dev.joomla.org/component/option,com_jd-wiki/Itemid,31/id,tutorials:components/
 * @license		GNU/GPL
 */

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the SharingWorld Component
 *
 * @package		Joomla.Tutorials
 * @subpackage	Components
 */
class SharingViewSharing extends JView
{
	


	function display($tpl = null)
	{
		
		switch ($this->getLayout())
		{
			case 'form':
				global $mainframe;

				// Get some objects from the JApplication

				$pathway	=& $mainframe->getPathway();
				$document	=& JFactory::getDocument();
				$user		=& JFactory::getUser();
				$uri     	=& JFactory::getURI();
				$params = &$mainframe->getParams();

				if ($user->guest)
				{
					$document->addScript( '/includes/js/joomla.javascript.js' );
				}
		
				// because the application sets a default page title, we need to get it
				// right from the menu item itself
				$params->set('page_title',	JText::_( JText::_('Submit a date') ));

				$document->setTitle( $params->get( 'page_title' ) );
				
				$date = JRequest::getVar( 'date', mktime() );
				JFilterOutput::objectHTMLSafe( $weblink, ENT_QUOTES, 'group' );
				
				$this->date = date("d/m/Y", $date);
				$this->assign( 'params',  $params);
				$this->assign('action', 	$uri->toString());
				parent::display($tpl);
		
			break;
			default:
				
				global $mainframe;

				// Get some objects from the JApplication

				$pathway	=& $mainframe->getPathway();
				$document	=& JFactory::getDocument();
				$user		=& JFactory::getUser();
				$uri     	=& JFactory::getURI();
				$params = &$mainframe->getParams();

				$this->assign( 'params',  $params);
				

/*				
				$cal = new calendar();
				$longMonthName = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December") ;

				$shortMonthName = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec") ;
				$cal->setMonthNames($longMonthName);
				$cal->setShortMonthNames($shortMonthName);
*/				
				

				parent::display($tpl);
			
			break;
		}

		
	}
	function getSharingByDate($date)
	{
		
		$model = $this->getModel( 'sharing');
		return $model->getSharingByDate( $date );
	
	}
}
?>
